package com.atguigu.lease.common.context;

import com.mysql.cj.log.Log;

public class LoginUserContext {

    public static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();


    public static void setLoginUser(Long userId, String username) {
        LoginUser loginUser = new LoginUser();
        loginUser.setUserId(userId);
        loginUser.setUsername(username);
        threadLocal.set(loginUser);
    }


    public static LoginUser getLoginUser() {
        return threadLocal.get();
    }


    public static void remove() {
        threadLocal.remove();
    }

}
